﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace BastInfos.Areas.Admin.Controllers
{
    public abstract class ControllerBase : Controller
	{
		protected int PAGE_SIZE = 10;

		protected int GetPage(int max)
		{
			int page = -1;
			string strPage = Request["page"];

			if (!Int32.TryParse(strPage, out page))
				page = 1;

			if (page > Math.Ceiling((decimal)max / PAGE_SIZE))
				page = (int)Math.Ceiling((decimal)max / PAGE_SIZE);

			return page;
		}
    }
}
